package com.future.controller;

import com.future.domain.DTO.UserLoginDTO;
import com.future.domain.Result;
import com.future.domain.User;
import com.future.service.RegisterService;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RegisterController {
    @Autowired
    private RegisterService registerService;
    @ApiOperation("发送验证码")
    @PostMapping("sendCode")
    public Result sendCode(String email){
        return registerService.sendCaptcha(email);
    }


    @ApiOperation("用户注册")
    @PostMapping("register")
    public Result register(@RequestBody UserLoginDTO user){
        return registerService.register(user);
    }
}
